<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .wrapper {
            background: #1890ff;
            height: 400px;
            width: 400px;
            position: relative;
        }

        /* 方案一：position绝对定位+margin负值 */
        /* .content {
            background: #FFB90F;
            width: 200px;
            height: 200px;
            position: absolute;
            left: 50%;
            top: 50%;
            margin: -100px 0 0 -100px;
        } */

        /*


        /* 方案二：position绝对定位+transform调整位置 */
        /* .content {
            background: #FFB90F;
            width: 200px;
            height: 200px;
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%,-50%);
        } */

        /* 

      
        
        /* 方案三：position绝对定位+margin：auto */
        .content {
            background: #FFB90F;
            width: 200px;
            height: 200px;
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            right: 0;
            margin: auto;
        }

        /* 方案四：flex弹性盒 */
        /* .wrapper {
            background: #1890ff;
            height: 400px;
            width: 400px;
            display: flex;
            justify-content: center;
            主轴方向居中
            align-items: center;
            侧轴方向居中
        } */

        /* .content {
            background: #FFB90F;
            width: 200px;
            height: 200px;
        } */
    </style>
</head>

<body>
    <div class="wrapper">
        <div class="content"></div>
    </div>
</body>

</html>